#ifndef HASHINGCORE_H_INCLUDED
#define HASHINGCORE_H_INCLUDED

template<class INT>
INT stringToUnsigned(char* string) {
    INT temp = 0;

    int length = 0;
    for (int i = 0; string[i] != '\0' ; ++i) {
        ++length;
    }

    for (int i = 0; i < length; ++i) {
        INT decimal = 0;
        for (int c = 0; c < 10; ++c) {
            if (string[length - (i + 1)] == characterArray[c]) {
                decimal = c;
                break;
            }
        }
        for (int c = 0; c < i; ++c) {
            decimal *= 10;
        }
        temp += decimal;
    }
    return temp;
}

template<class INT>
char* unsignedToString(const INT number) {
    char buffer[39];
    INT temp = number;
    int length = 0;
    char* stringPointer;

    if (number == 0) {
        stringPointer = new char[2];
        stringPointer[0] = '0';
        stringPointer[1] = '\0';
        return stringPointer;
    }

    while (temp > 0) {
        int decimal = temp % 10;
        buffer[39 - (length + 1)] = characterArray[decimal];
        temp = temp / 10;
        ++length;
    }

    stringPointer = new char[length + 1];

    for (int i = 0; i < length; ++i) {
        stringPointer[i] = buffer[(39 - length) + i];
    }
    stringPointer[length] = '\0';

    return stringPointer;
}

#endif // HASHINGCORE_H_INCLUDED
